using UnityEngine;
using System.Collections;
using System.Text; 
//using System.Diagnostics;
using System.IO;
using System.Xml;


class Tools
{		
//	static Atom[] XMLAtomExtraction ( string sFile )
//	{
//		XmlDocument xmlDoc = new XmlDocument ();
//	
//		TextAsset textAsset = (TextAsset)Resources.Load ("Files/Atom" + sFile, typeof(TextAsset));
//				
//		Debug.Log ("textAsset : " + textAsset);
//		Debug.Log ("textAsset.text : " + textAsset.text);
//		
//		if (textAsset.text != string.Empty)
//			xmlDoc.LoadXml (textAsset.text);
//		else
//			Debug.LogError ("Level does not exist must be created before");
//			
//		//Atom parameters
//		XmlNodeList atomList = xmlDoc.GetElementsByTagName ("Atom");
//		
//		if( atomList != null )
//		{
//			Atom[] atomArray = new Atom[atomList.Count];
//			foreach( XmlNode nodeAtom in atomList )
//			{
//				Atom atom = new Atom();
//			}
//		}
//	}	
	
//	static public GameObject CreateObjectFromPrefab(  GameObject pPrefab, Transform pParent, Vector3 vPos )
//	{
//		GameObject pObject = null;
//		if ( pPrefab	!= null )
//		{
//			pObject = GameObject.Instantiate( pPrefab ) as GameObject;
//			pObject.transform.parent = pParent;
//			pObject.transform.localPosition = vPos;
//			pObject.transform.localScale = Vector3.one;
//		}
//		return pObject;
//	}
//
//	static public GameObject CreateObjectFromAssetBundle(  AssetBundle pAssetBundle, string sPrefabName, Transform pParent, Vector3 vPos )
//	{
//		GameObject pPrefab = null;
//		if ( pAssetBundle	!= null )
//		{
//			pPrefab = pAssetBundle.Load( sPrefabName, typeof(GameObject) ) as GameObject;
//		}
//		return CreateObjectFromPrefab( pPrefab, pParent, vPos );
//	}
//	
//	// ***************************************************************
//	// TOOLS EDITOR **************************************************
//	// ***************************************************************
//	public static string GetImagesFolder()
//	{
//		return PlayerPrefs.GetString("ToolsEditor.sourceImagesFolder", "INVALIDPATH");
//	}
//	
//	public static void SetImagesFolder(string path)
//	{
//		path = path.Replace("\\", "/");
//		PlayerPrefs.SetString("ToolsEditor.sourceImagesFolder", path);
//	}
//	
//	static public void DestroyObject<T>( ref T pObject ) where T : Object
//	{
//		if ( pObject != null )
//		{
//			System.Type Tp = typeof(T);
//			if ( Tp.Equals(typeof(GameObject)) || Tp.IsSubclassOf( typeof(GameObject) ) )
//				internalDestroyObject( pObject as GameObject );
//			else if ( Tp.IsSubclassOf( typeof(Component) ) )
//			{
//				Component pBehaviour = pObject as Component;
//				internalDestroyObject( pBehaviour.gameObject );
//			}
//			else
//				Debug.LogError( "DestroyObject() : Trying to destroy an object of type " + Tp + " wich is not a GameObject nor a MonoBehaviour." );
//
//			pObject = null;
//		}
//	}
//		
//	static public void internalDestroyObject( GameObject pObject )
//	{
//		if ( pObject != null )
//		{
////			Debug.Log( "Destroying object " + pObject.name );
//			foreach( MonoBehaviour pComponent in pObject.GetComponentsInChildren( typeof(MonoBehaviour), true ) )
//			{
//				//Debug.Log(pComponent.name);
//				if ( pComponent.GetType().IsSubclassOf( typeof(SpriteRoot) ))
//				{
//					//Debug.Log( "Deleting sprite " + pObject.name );
//					SpriteRoot pSprite = pComponent as SpriteRoot;
//					pSprite.Delete();
//				}
//				else if( pComponent.GetType().IsSubclassOf( typeof(SpriteText) ) )
//				{
//					SpriteText pSpriteText = pComponent as SpriteText;
//					pSpriteText.Delete();
//				}
//				Object.Destroy(pComponent);
//			}
//			Object.Destroy( pObject );
//		}
//	}
//		
}  
 

